package pojo;

import java.util.Objects;

/**
 * 存储ip和port，对应一个server，Socket
 */
public class ServerMsg {
    private final String ip;
    private final Integer port;

    public ServerMsg(String ip, Integer port) {
        this.ip = ip;
        this.port = port;
    }

    public String getIp() {
        return ip;
    }

    public Integer getPort() {
        return port;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        ServerMsg serverMsg = (ServerMsg) o;
        return Objects.equals(ip, serverMsg.ip) && Objects.equals(port, serverMsg.port);
    }

    @Override
    public int hashCode() {
        return Objects.hash(ip, port);
    }

    @Override
    public String toString() {
        return "ServerMsg{" +
                "ip='" + ip + '\'' +
                ", port=" + port +
                '}';
    }
}
